@import (once) "../../include/vars";
@import (once) "../../include/mixins";

.app-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 52px;
    z-index: @zindex-fixed;
    background-color: @light;
    flex-flow: row wrap;
    align-items: center;
}

.app-bar {

    .app-bar-container {
        background-color: inherit;
        color: inherit;
    }

    .brand, .app-bar-item, .app-bar-container, .app-bar-button {
        display: flex;
        align-items: center;
        position: relative;
        height: 52px;
        line-height: 52px;
        padding: 0 16px;
        background-color: inherit;
        color: inherit;
        text-decoration: none;
        font-size: 14px;
        flex-shrink: 0;
        border: none;
        justify-content: center;

        &:focus {
            outline: none;
        }
    }

    .app-bar-container {
        padding: 0;
    }

    .app-bar-item {
        white-space: nowrap;
    }

    .app-bar-button {
        width: 52px;
        padding: 0;
    }

    .app-bar-menu {
        flex-shrink: 0;
        list-style: none inside;
        margin: 0;
        padding: 0;
        position: relative;
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        flex-direction: column;
        background-color: inherit;
        color: inherit;
    }

    .app-bar-menu {
        & > li, & > li  > a {
            display: block;
            line-height: 52px;
            background-color: inherit;
            color: inherit;
            flex-shrink: 0;
        }

        & > li  > a {
            padding: 0 16px;
            text-decoration: none;
            font-size: 14px;
            position: relative;
        }

        & > li {
            position: relative;
        }

        a {
            &:hover {
                text-decoration: none;
            }
        }
    }

    .brand:not(.no-hover), .app-bar-menu li:not(.no-hover), .hamburger:not(.no-hover), .app-bar-item:not(.no-hover) {
        &:hover, &:active, .active {
            background: @hoverBackground;
        }
    }

    .hamburger {
        position: absolute;
        right: 0;
        top: 0;
        display:block;
        height: 52px;
        width: 52px;

        &.menu-down {
            &.active {
                .line:nth-child(1), .line:nth-child(3) {
                    margin: -4px 16px;
                }
            }
        }
    }

    .app-bar-menu {
        .d-menu, .v-menu {
            box-shadow: none;
            position: relative;
            width: 100%;
            background-color: @light;
        }
    }

    .app-bar-menu, .app-bar-container {
        .divider {
            height: 1px!important;
            line-height: 1px!important;
            background-color: @lightGray;
        }
    }

    .app-bar-container {
        .d-menu {
            background-color: @light;
            position: absolute;
            width: auto;
            .default-shadow();
        }

        .v-menu {
            position: absolute;
            float: left;
            width: auto;
            border: 1px solid @borderColor;
            background-color: @white;
        }

        & > .d-menu, & > .v-menu {
            top: 100%;
        }

        a {
            color: inherit;
            text-decoration: none;
        }
    }

    a {
        outline: none!important;
    }

    .app-bar-menu .d-menu .d-menu,
    .app-bar-menu .v-menu .v-menu,
    .app-bar-menu .v-menu .d-menu,
    .app-bar-menu .d-menu .v-menu
    {
        left: 0;
    }

    .app-bar-menu {
        &.opened {
            max-height: ~"calc(100vh - 52px)";
            overflow-y: auto;
        }
    }
}

.app-bar {
    .app-bar-input {
        width: 100px;
        height: 30px;
        font-size: .875rem;
        border: none!important;
        border-radius: 4px;
    }
}


.app-bar {
    .hamburger:not(.hidden) ~ .ml-auto {
        margin-right: 48px;
    }
}

.app-bar-expand {

    flex-wrap: nowrap;
    flex-flow: row;

    .brand, .app-bar-item, .app-bar-container {
        width: auto;
        flex-shrink: 1;
    }

    .app-bar-menu {
        float: left;
    }

    .app-bar-menu {
        width: auto;
        flex-direction: row;
    }

    .app-bar-menu {
        .d-menu {
            position: absolute;
            width: auto;
            .default-shadow();

            li, a {
                height: 38px;
                line-height: 38px;
            }
        }

        .v-menu {
            position: absolute;
            float: left;
            width: auto;
            border: 1px solid @borderColor;
            background-color: @white;
        }

        &.collapsed {
            display: flex!important;
        }
    }

    .app-bar-menu .d-menu .d-menu,
    .app-bar-menu .v-menu .v-menu,
    .app-bar-menu .v-menu .d-menu,
    .app-bar-menu .d-menu .v-menu
    {
        left: 100%;
    }

    .hamburger {
        display: none;
    }
}

.p-ab {
    padding-top: 52px!important;
}

.m-ab {
    margin-top: 52px!important;
}

.h-ab {
    height: ~"calc(100% - 52px)";
}
